package com.liuguangzhou.utils;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import redis.clients.jedis.Jedis;
import redis.clients.jedis.JedisPool;

/**
 * @Classname JadisUtil
 * @Author liuguangzhou
 * @Date 2020-04-06
 */
@Component
public class JadisUtil {
    @Autowired
    private JedisPool jedisPool;

    public Jedis getJedis(){
        return jedisPool.getResource();
    }


    public void closeJedis(Jedis jedis){
        if (jedis!=null){
            jedis.close();
        }
    }
}
